import { initSocket } from './index'

// 监听成功加入直播间
// see-live-broadcadcast 页面使用
export const AlreadySetJoin = (fn) => {
	initSocket.socket.on('already-set-join', (data) => {
		fn(data)
	})
}

// 监听连接获取正在直播的直播间
// live-pusher-page 页面使用
export const LiveBroadcastList = (fn) => {
	initSocket.socket.on('live-broadcast-list', (data) => {
		fn(data)
	})
}

// 新开的直播
// live-pusher-page 页面使用
export const NewLiveBroadcast = (fn) => {
	initSocket.socket.on('new-live-broadcast', (data) => {
		fn(data)
	})
}

// 监听新的直播开启
// live-pusher-page 页面使用
export const GroupList = (fn) => {
	initSocket.socket.on('group-list', (data) => {
		fn(JSON.parse(data))
	})
}

// 关闭直播事件监听
// see-live-broadcadcast 页面使用
export const LeaveRoomExit = (fn) => {
	initSocket.socket.on('leave-room-exit', (data) => {
		fn(data)
	})
}

// 广播用户关闭直播事件监听
// live-pusher-page 页面使用
export const LeaveRoomExitAll = (fn) => {
	initSocket.socket.on('leave-room-exit-all', (data) => {
		fn(data)
	})
}


// 监听离开直播间的用户
// see-live-broadcadcast 页面使用
export const AlreadyExitJoin = (fn) => {
	initSocket.socket.on('already-exit-join', (data) => {
		fn(data)
	})
}

// 监听直播间人数
// live-pusher-page 页面使用
export const SeeQuantity = (fn) => {
	initSocket.socket.on('see-quantity', (data) => {
		fn(data)
	})
}
